
* =================================
* Paper title: It's All About Political Incentives: Democracy and the Renewable Feed-In Tariff
* Authors: Patrick Bayer (Glasgow) and Johannes Urpelainen (Columbia) 
* Journal of Politics

* Last modified: November 7, 2015

* Data files used: FIT_recoded.dta (called through prep.do)
* System: Stata 13.1 on WIN 10

* Purpose: This do file replicates the results with recoded FIT data (Appendix A13)
* =================================

*NB: Place all files in the same folder for paths to work properly

clear all
set more off, permanently

use "FIT_recoded.dta"


* =================================
* 0. Recode FIT adoption according to data for OECD FIT levels
* =================================

replace FIT=1 if FIT_level > 0 & FIT_level !=.
replace FIT=0 if FIT_level == 0 & FIT_level !=.

* Adjust coding for Finland from 2007 to 2011; 2007 FIT was for peat only
replace FIT=0 if country=="Finland" & year < 2011

drop L1FIT

* =================================
* 1. Appendix A13: Different FIT coding 
* =================================

* Format data for survival analysis
xtset id year
gen L1FIT = L1.FIT

replace FIT=1 if L1.FIT==1
drop if FIT==1 & L1.FIT==1

drop if year < 1990
drop if FIT == .
drop L1FIT


* Reestimate main model with recoded data (Table A12)
eststo clear
eststo: xi: logit FIT L1democracy L1diffusion_norm L1polcon3 L1loggdppc L1logpop L1logland L1corruption OECD EU t t2 t3 i.region, vce(cluster id)
eststo: xi: logit FIT L1democracy L1diffusion_norm L1polcon3 L1loggdppc L1logpop L1logland L1corruption L1logco2pc L1fossilfuel L1elecgen L1reform OECD EU t t2 t3 i.region, vce(cluster id)
eststo: xi: logit FIT L1democracy L1diffusion_norm L1polcon3 L1loggdppc L1logpop L1logland L1corruption L1logco2pc L1fossilfuel L1elecgen L1reform L1logtrade L1logfdi L1kyoto OECD EU t t2 t3 i.region, vce(cluster id) 

eststo: xi: logit FIT L1polity L1diffusion_norm L1polcon3 L1loggdppc L1logpop L1logland L1corruption OECD EU t t2 t3 i.region, vce(cluster id)
eststo: xi: logit FIT L1polity L1diffusion_norm L1polcon3 L1loggdppc L1logpop L1logland L1corruption L1logco2pc L1fossilfuel L1elecgen L1reform OECD EU t t2 t3 i.region, vce(cluster id)
eststo: xi: logit FIT L1polity L1diffusion_norm L1polcon3 L1loggdppc L1logpop L1logland L1corruption L1logco2pc L1fossilfuel L1elecgen L1reform L1logtrade L1logfdi L1kyoto OECD EU t t2 t3 i.region, vce(cluster id) 


/* esttab using "FIT_main_OECDcoding.tex", replace b(%9.2f) booktabs stats(N N_clust r2_p, labels("Observations" "Countries" "Pseudo $ R^2$") fmt(0 0 3)) /// 
eqlabels(none) drop(_cons OECD EU t* _Iregion_*) noconstant se label nonotes legend star(* 0.10 ** 0.05 *** 0.01) ///
mtitles("Model" "Model" "Model" "Model" "Model" "Model") ///
addnote ("Dependent Variable: FIT dummy." "Standard errors in parentheses and clustered by country." "All models include OECD and EU dummies, region fixed effects, and a cubic time polynomial.") ///
order(L1democracy L1polity L1diffusion_norm L1polcon3 L1loggdppc L1logpop L1logland L1corruption L1logco2pc L1fossilfuel L1elecgen L1reform L1logtrade L1logfdi L1kyoto)
*/
